﻿@model ScmCostactualViewModel
@{
    Layout = null;
    ViewBag.Title = "费用使用-列表";
    int num = 1;
}

<div class="page" style="border-top: 1px solid #b8d0d6;" layouth="1">
    @using (Html.BeginForm("SplitPage", "ScmCostActual", null, FormMethod.Post, new { id = "pagerForm", onsubmit = "return navTabSearch(this);" }))
    {
        <input type="hidden" name="pageNum" value="1" />
        <input type="hidden" name="numPerPage" value="@(ViewBag.numPerPage)" />
        <ul class="searchBar">
            <li><span>标段：</span>
                <input type="text" name="iput_biaoduan" value="@(ViewBag.iput_biaoduan)" />
            </li>
            <li><span>施工单位：</span>
                <input type="text" name="iput_unit" value="@(ViewBag.iput_unit)" />
            </li>
            <li><span>日期：</span>
                <input type="text" name="iput_timestart" value="@(ViewBag.iput_timestart)" class="date" format="yyyy年M月" />
                <span>-</span>
                <input type="text" name="iput_timeend" value="@(ViewBag.iput_timeend)" class="date" format="yyyy年M月" />
            </li>
            <li>
                <button type="submit" class="btn btn-success btn-xs">
                    搜索</button>
            </li>
        </ul>
    }
    <div class="panelBar" style="border-top:none;">
        <ul class="toolBar">
            <li>
                @Html.PermissionButton("SafetyConstruction.ScmCostActual.Create", "fysy_add_Id",
                    Url.Action("CostActualAdd", "ScmCostActual"),
                    "添加",
                    new Dictionary<string, object>
                    {
                        {"class","add"},{"rel","fysy_add"} ,{"mask","true"},{"target","dialog"},{"width","1090"},{"height","660"}
                    })
            </li>
            <li>
                @Html.PermissionButton("SafetyConstruction.ScmCostActual.Delete", "fysy_delete_Id",
                                      Url.Action("CostActualDelete", "ScmCostActual", new { id = "{ids}" }),
                    "删除",
                    new Dictionary<string, object>
                    {
                        {"class","delete"},{"rel","ids"} ,{"title","确定要删除这些记录吗?"},{"target","ajaxTodo"},{"postType","string"}
                    })
            </li>
            <li>
                @Html.PermissionButton("SafetyConstruction.ScmCostActual.Edit", "fysy_edit_Id",
                    Url.Action("CostActualEdit", "ScmCostActual", new { id = "{ids}" }),
                    "修改",
                    new Dictionary<string, object>
                    {
                        {"class","edit"},{"rel","fysy_edit"} ,{"mask","true"},{"target","dialog"},{"width","1090"},{"height","660"},{"warn","请选择一条信息!"}
                    })
            </li>
            <li>
                @Html.PermissionButton("SafetyConstruction.ScmCostActual.Detail", "fysy_detail_Id",
                    Url.Action("CostActualView", "ScmCostActual", new { id = "{ids}" }),
                    "查看",
                    new Dictionary<string, object>
                    {
                        {"class","detail"},{"rel","fysy_detail"} ,{"mask","true"},{"target","dialog"},{"width","1090"},{"height","660"},{"warn","请选择一条信息!"}
                    })
            </li>
            <li>
                @Html.PermissionButton("SafetyConstruction.ScmCostActual.Audit", "fysy_audit_Id",
                    Url.Action("CostActualAudit", "ScmCostActual", new { id = "{ids}" }),
                    "审批",
                    new Dictionary<string, object>
                    {
                        {"class","check"},{"rel","fysy_audit"} ,{"mask","true"},{"target","dialog"},{"width","1090"},{"height","660"},{"warn","请选择一条信息!"}
                    })
            </li>
        </ul>
    </div>
    <table class="table" width="100%" layouth="122" nowraptd="false">
        <thead>
            <tr>
                <th style="text-align: center;display:none" width="22">
                    <input type="checkbox" group="ids" class="checkboxCtrl">
                </th>
                <th style="text-align: center" width="30">
                    序号
                </th>
                <th style="text-align: center" width="100">
                    标段
                </th>
                <th style="text-align: center" width="400">
                    施工单位
                </th>
                <th style="text-align: center" width="100">
                    年份
                </th>
                <th style="text-align: center" width="200">
                    审批状态
                </th>
            </tr>
        </thead>
        <tbody>
            @{  num = (ViewBag.pageNum - 1) * ViewBag.numPerPage + 1;}
            @foreach (var item in Model.TheCostActualMainList)
            {
                <tr target="ids"  rel="@item.Cam_ID" data-costactual="true" data-state="@item.Cam_State">
                    <td style="text-align: center;display:none">
                        <input name="ids" value="@item.Cam_ID" type="checkbox">
                    </td>
                    <td style="text-align: center">@num
                    </td>
                    <td style="text-align: center">
                        @*<a title="查看" target="navTab" href="@Url.Action("CostActualView", "ScmCostActual", new { id = @item.Cam_ID })">*@
                            @item.Cam_Section  @*</a>*@
                    </td>
                    <td style="text-align: center">@item.Cam_ConstructionName
                    </td>
                    <td style="text-align: center">@Html.Label("Cam_YearMonth", string.Format("{0:yyyy年M月}", item.Cam_YearMonth))
                    </td>
                    <td style="text-align: center">@(item.Cam_State == 0 ? "未审批" : (item.Cam_State == 2 ? "审批不通过" : "审批通过"))
                    </td>
                </tr>
                                               num++;
            }
        </tbody>
    </table>
    <div class="panelBar" style="border-bottom:none;">
        <div class="pages" style="float: right">
            <span>显示</span>
            <select class="comsplitpage" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
               <option value="10" @(ViewBag.numPerPage == 10 ? "selected='selected'" : "")>10</option>
                <option value="20" @(ViewBag.numPerPage == 20 ? "selected='selected'" : "")>20</option>
                <option value="50" @(ViewBag.numPerPage == 50 ? "selected='selected'" : "")>50</option>
            </select>
            <span>条，共@(ViewBag.pagenumshown)页,@(ViewBag.totalcount)条</span>
        </div>
        <div class="pagination" style="margin:0px;float:left; margin-left:35%" targettype="navTab" totalcount="@(ViewBag.totalcount)" numperpage="@(ViewBag.numPerPage)" pagenumshown="10" currentpage="@(ViewBag.pageNum)">
        </div>
    </div>
</div>
<script>
    $.jTableTool.clickRowAction(function ($row) {
        if ($row) {
            debugger;
            var isCheck = $row.data("costactual");
            var state = $row.data("state");

            if (isCheck) {
                //已审核隐藏修改、删除
                if (state != 0) {
                    //已经审核了
                    $("#fysy_delete_Id").hide();
                    $("#fysy_edit_Id").hide();
                    $("#fysy_audit_Id").hide();

                } else {
                    $("#fysy_delete_Id").show();
                    $("#fysy_edit_Id").show();
                    $("#fysy_audit_Id").show();
                }
            }
        }
    });
</script>
